package com.peas.platform.common.core.configuration;

import feign.RequestInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.cloud.openfeign.loadbalancer.FeignLoadBalancerAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author caizhh
 */
@Configuration
@AutoConfigureAfter(FeignLoadBalancerAutoConfiguration.class)
@Slf4j
public class FeignConfig {

    @Value("${app.core:peas-module-sys-core}")
    public static String core = "peas-module-sys-core";

    @Bean
    public RequestInterceptor requestInterceptor() {
        return template -> log.debug(template.headers().toString());
    }

}
